# 断言封装
import requests


def ihrmAssert(status_code, success, code, message, resp):
    assert status_code == resp.status_code
    assert success == resp.json().get('success')
    assert code == resp.json().get('code')
    assert message in resp.json().get('message')


if __name__ == '__main__':
    herderJson = {"Content-Type": "application/json"}
    jsonData = {"mobile": '13800000002', "password":'123456'}
    resp = requests.post(url='http://ihrm2-test.itheima.net/api/sys/login',
                         headers=herderJson,
                         json=jsonData)
    print(resp.json())
    ihrmAssert(200, True, 10000, '成功', resp)
